package com.heima.es.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * @BelongsProject: heima-leadnews
 * @BelongsPackage: com.heima.es.pojo
 * @Author: wangjian
 * @CreateTime: 2022-07-10  23:51
 * @Description: TODO
 * @Version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor //,type = "goods"
@Document(indexName="goods",shards = 3,replicas = 1)
public class Goods implements Serializable {
    @Field(type = FieldType.Long)
    private Long id;
    @Field(type = FieldType.Text,analyzer = "ik_max_word",store = true)
    private String title; //标题
    @Field(type = FieldType.Keyword,index = true,store = true)
    private String brand; // 品牌
    @Field(type = FieldType.Double,index = true,store = true)
    private Double price; // 价格
    @Field(type = FieldType.Keyword,index = false,store = true)
    private String images; // 图片地址

    public Goods() {
    }

    public Goods(Long id, String title, String brand, Double price, String images) {
        this.id = id;
        this.title = title;
        this.brand = brand;
        this.price = price;
        this.images = images;
    }
}
